<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="shortcut icon" href="http://18715232917.host3v.com/peanut.ico" type="image/x-icon">
	<link rel="stylesheet" href="./stylesheets/css/userlogin.css">
	<link rel="stylesheet" href="./stylesheets/css/myCssReset.css">
	<title>Document</title>
	<script src="./javascripts/common/jquery.min.js"></script>
</head>

<body>
	<div class="box">
		<!-- 头盒子 -->
		<div class="box-head">
			<!-- 头 -->
			<div class="head">
				<img src="./images/page/log.png" width="142" alt="花生">
			</div>
		</div>
		<!-- 空位和登录窗口 -->
		<div class="box-body">
			<!-- 空位 -->
			<div class="none">
			</div>
			<!-- 窗口 -->
			<div class="tab">
				<!-- 注册登录切换按钮 -->
				<ul class="title">
					<li class="active">注册</li>
					<li>密码登录</li>
				</ul>
				<div class="zdy-xy">
					<span>请仔细阅读 <a href="" class=""> 花生使用协议、花生个人信息保护政策</a></span>
				</div>
				<!-- 切换卡内容 -->
				<div id="content">
					<div class="mod">
						<ul>
							<li><input type="text" placeholder="手机号/邮箱" id="phone" value=""></li>
							<li><input type="password" placeholder="密码" id="pwd" value=""> </li>
							<li><button class="btn" id="btn">用户注册</button></li>
						</ul>
					</div>
					<div class="mod" style="display: none">
						<ul>
							<li><input type="text" placeholder="花生账号" id="phone1" value=""></li>
							<li><input type="password" placeholder="密码" id="pwd1" value=""></li>
							<li><button class="btn">用户登录</button></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- 切换卡内容脚本 -->
	
	<script type="text/javascript">
		$(function () {
			$(".title li").click(function () {
				//            var $this=$(this);
				//            alert($this.index());
				$(this).addClass("active").siblings().removeClass("active");
				$("#content .mod").eq($(".title li").index(this)).show().siblings("#content .mod").hide();
			});
		});
	</script>
	<!-- ajxs -->
	<!-- 用户注册 -->
	<script>
		var userphone = document.getElementById('phone')
		var userpwd = document.getElementById('pwd')
		btn.onclick = function () {
			var uphoneval = userphone.value.trim();
			var upwd = userpwd.value.trim();
			var btn = document.getElementById('btn')
			if (uphoneval && upwdl) {
				$.ajax({
					url: 'http://localhost:3000/user/register',
					method: 'post',
					data: {
						u_phone: uphoneval,
						u_pwd: upwd
					},
					success: result => {
						console.log(result)
					},
					error: err => {
						console.log(err)
					}
				})
			} else {
				alert('内容不能为空')
			}
		}
	</script>
	<!-- 用户登录 -->
	<script>
		var userphone = document.getElementById('phone1')
		var userpwd = document.getElementById('pwd1')
		var btn = document.getElementById('btn')
		btn.onclick = function() {
			window.location.href = 'http://localhost:3000/index1.html'
		}
		/*btn.onclick = function () {
			var uphoneval = userphone.value.trim();
			var upwd = userpwd.value.trim();
			if (uphoneval && upwdl) {
				$.ajax({
					url: 'http://localhost:3000/user/login',
					method: 'post',
					data: {
						uaccount=uphoneval,
						upwd=upwd
					},
					success: result => {
						console.log(result)
					},
					error: err => {
						console.log(err)
					}
				})
			} else {
				alert('内容不能为空')
			}
		}*/

	</script>
</body>

</html>